package com.ssh.dao;

import com.ssh.pojo.Employee;
import org.hibernate.criterion.DetachedCriteria;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;

import java.util.List;

public class EmployeeDAO extends HibernateDaoSupport {
    //添加员工
    public void addEmployee(Employee employee) {
        super.getHibernateTemplate().save(employee);
    }

    //根据条件查询员工列表
    public List<Employee> getEmpList(DetachedCriteria criteria) {
        return (List<Employee>) super.getHibernateTemplate().findByCriteria(criteria);
    }
}
